
var sum = [];
Ext.define('sheath.view.main.CaseGrid', {
    /* sheetGird必须必须继承 MTTECERP.view.aaSelfCtrl.grid.sheetGrid */
    extend: 'sheath.view.base.sheetGrid',
    /*这儿是自己对应的controller*/
    xtype: 'casegrid',
    requires: ['Ext.util.Collection', 'Ext.grid.plugin.Clipboard', 'Ext.grid.selection.SpreadsheetModel'],
    /*这儿是自己对应的controller*/
    id:'usergrids',
    /*
    * 状态id
    * 如果不需要状态保持 -> stateful:false， stateId也不需要
    * stateId 命名规则不能重复
    *         命名规则 模块.支模块.主键类型.编号
    */
    // stateId: 'usergrid',
    // itemId: 'usergrids',
    //selModel: {
    //    type: 'spreadsheet',
    //    columnSelect: true  // replaces click-to-sort on header  
    //},
    plugins: 'clipboard',//自定义查询框
    initComponent: function () {
        /* 初始化 store */

        //extraParams: { param1: 1, param2: 2 },
        //url: 'http://localhost:8899/api/order/ext',
        //idProperty: 'indexid',

        Ext.apply(this, {
            store: Ext.create('sheath.store.CaseGrid'),
            listeners: {
                selectionchange: function (model, records, seletedGrid) {

                    if (records != 'undefined' && records.length > 0) {
                        var fm = [];
                        for (var i = 0; i <records.length; i++) { //循环每一行
                            fm[fm.length] = records[i].data.IndexID //fm就是你要的
                        }
                          sum = fm
                    } else {
                        console.log("测试")
                        sum = [];
                        console.log(sum)
                    }
                    console.log(sum)
                }
            },
        dockedItems: [{
        xtype: 'toolbar',
        dock: 'top',
        ui: 'footer',
        margin:'-12 0 0 0',
    }, {
        xtype: 'toolbar',
        items: [{
            text: '导出'
        },'->',{
            text:'添加子用例'
        },'-',{
            text:'作废子用例'
        }]
    }],
    // 'caseName', 'caseStatus','caseFrequency','lastperson','lasttime'
            columns:
                [   
                     {
                      text: '用例任务',
                      flex: 1,
                      filter: {
                          type: 'numeric'
                      },
                      dataIndex: 'taskId',
                      filter: true
                  },                                            
                   {
                       text: '子用例名称',
                       flex: 1,
                       filter: {
                            type: 'string'
                                },
                        dataIndex: 'caseName',
                        filter: true
                    },
                     {
                       text: '等级',
                       flex: 1,
                       filter: {
                            type: 'string'
                                },
                        dataIndex: 'caseLevel',
                        filter: true
                    },
                    {
                        text: '状态',
                        flex: 1,
                        filter: {
                               type: 'numeric'
                                },
                         dataIndex: 'caseStatus',
                           filter: false
                         },
                         {
                            text: '执行次数',
                            flex: 1,
                            filter: {
                                    type: 'numeric'
                                },
                            dataIndex: 'caseFrequency',
                                   filter: false
                               },
                                     {
                                    text: '最后操作人',
                                    flex: 1,
                                    filter: {
                                        type: 'string'
                                    },
                                    dataIndex: 'lastperson',
                                    filter: true
                                },
                                     {
                                    text: '最后更改时间',
                                    flex: 1,
                                    filter: {
                                        type: 'string'
                                    },
                                    dataIndex: 'lasttime',
                                    filter: true
                                }

                ],
         
            
        });
        this.callParent();
    },
});